import request from '@/config/axios'

// 跨境电商平台分类映射 VO
export interface PlatformCategoryMappingVO {
  id: number // 映射编号
  platformId: number // 平台编号
  localCategoryId: number // 本地分类ID
  localCategoryName: string // 本地分类名称
  platformCategoryId: string // 平台分类ID
  platformCategoryName: string // 平台分类名称
  platformCategoryPath: string // 平台分类路径
  mappingLevel: number // 映射级别（1一级 2二级 3三级等）
  mappingConfidence: number // 映射置信度（0.00-1.00）
  isAutoMapped: boolean // 是否自动映射
  mappingRule: string // 映射规则JSON
  status: number // 状态（0正常 1停用）
}

// 跨境电商平台分类映射 API
export const PlatformCategoryMappingApi = {
  // 查询跨境电商平台分类映射分页
  getPlatformCategoryMappingPage: async (params: any) => {
    return await request.get({ url: `/crossborder/platform-category-mapping/page`, params })
  },

  // 查询跨境电商平台分类映射详情
  getPlatformCategoryMapping: async (id: number) => {
    return await request.get({ url: `/crossborder/platform-category-mapping/get?id=` + id })
  },

  // 新增跨境电商平台分类映射
  createPlatformCategoryMapping: async (data: PlatformCategoryMappingVO) => {
    return await request.post({ url: `/crossborder/platform-category-mapping/create`, data })
  },

  // 修改跨境电商平台分类映射
  updatePlatformCategoryMapping: async (data: PlatformCategoryMappingVO) => {
    return await request.put({ url: `/crossborder/platform-category-mapping/update`, data })
  },

  // 删除跨境电商平台分类映射
  deletePlatformCategoryMapping: async (id: number) => {
    return await request.delete({ url: `/crossborder/platform-category-mapping/delete?id=` + id })
  },

  // 批量删除跨境电商平台分类映射
  deletePlatformCategoryMappingList: async (ids: number[]) => {
    return await request.delete({ url: `/crossborder/platform-category-mapping/delete-batch`, data: ids })
  },

  // 导出跨境电商平台分类映射 Excel
  exportPlatformCategoryMapping: async (params) => {
    return await request.download({ url: `/crossborder/platform-category-mapping/export-excel`, params })
  },
}
